Skip to content

fix(storage): preserve leading slashes in FsspecStore.path#3926

Open
d-v-b wants to merge 2 commits intozarr-developers:mainfrom
d-v-b:fix/unbreak-fsspec-path-normalization
Open

fix(storage): preserve leading slashes in FsspecStore.path#3926
d-v-b wants to merge 2 commits intozarr-developers:mainfrom
d-v-b:fix/unbreak-fsspec-path-normalization

Conversation

@d-v-b
Copy link
Copy Markdown
Contributor

@d-v-b d-v-b commented Apr 27, 2026

#3924 ran the constructor's path argument through normalize_path,
which is intended for zarr logical keys and strips leading slashes.
Applied to a filesystem-side root, this turned absolute paths like
/home/foo/data.zarr into the relative home/foo/data.zarr, breaking
LocalFileSystem-backed FsspecStore for any caller that passed an
absolute path. Downstream impact: titiler-xarray's test-upstream job
fails on every dataset_3d.zarr fixture access.

The original #3922 issue (path="/" producing "//key" via _join_paths)
is still resolved: rstrip("/") collapses "/" to "", so the join filter
drops it. Trailing slashes are also still stripped.

Updates the existing test_fsspec_store_path_normalization
parametrization with the new (correct) expectations and adds two
absolute-path cases.

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

cc @vincentsarago

zarr-developers#3924 ran the constructor's `path` argument through `normalize_path`,
which is intended for zarr logical keys and strips leading slashes.
Applied to a filesystem-side root, this turned absolute paths like
/home/foo/data.zarr into the relative home/foo/data.zarr, breaking
LocalFileSystem-backed FsspecStore for any caller that passed an
absolute path. Downstream impact: titiler-xarray's test-upstream job
fails on every dataset_3d.zarr fixture access.

The original zarr-developers#3922 issue (path="/" producing "//key" via _join_paths)
is still resolved: rstrip("/") collapses "/" to "", so the join filter
drops it. Trailing slashes are also still stripped.

Updates the existing test_fsspec_store_path_normalization
parametrization with the new (correct) expectations and adds two
absolute-path cases.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@d-v-b d-v-b requested a review from maxrjones April 27, 2026 11:15
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.11%. Comparing base (029c376) to head (3db5e6a).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3926   +/-   ##
=======================================
  Coverage   93.11%   93.11%           
=======================================
  Files          85       85           
  Lines       11365    11365           
=======================================
  Hits        10582    10582           
  Misses        783      783           
Files with missing lines Coverage Δ
src/zarr/storage/_fsspec.py 91.32% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Member

@maxrjones maxrjones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the changelog entry necessary? This regression wasn't released, which makes me wonder if it adds confusion rather than clarity. It could be better as an in-line comment to prevent future mistakes with this fragile part of the codebase.

@d-v-b
Copy link
Copy Markdown
Contributor Author

d-v-b commented Apr 28, 2026

Is the changelog entry necessary? This regression wasn't released, which makes me wonder if it adds confusion rather than clarity. It could be better as an in-line comment to prevent future mistakes with this fragile part of the codebase.

that's a good point, I will remove the changelog entry and add the comment as you suggest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants